name_list=["Zhangsan","liSi","Wangwu"]
print(name_list[2])
print(name_list.index("liSi"))
temp_list=["悟空","朱而过","沙师弟"]
temp_list.reverse()
print("反转过的列表",temp_list)
name_list.extend(temp_list)
del temp_list[0]# del  关键字是把变量从内存中删除
print("弹出了",temp_list)
print(name_list)
# test_list=temp_list.clear()
print(temp_list.pop())
# print(test_list)

#下面是元祖的定义
info_tuple=("张三",232,1.7543)
print(type(info_tuple))
single_tuple=(50,)
for info in info_tuple:
    tmp_str=info.__str__()
    print("将打印的信息是"+tmp_str)

#格式化字符串 () 本质上就是一个元祖
fit_info=("小明",21,1.75)
infostr="%s 年龄是 %d 身高是%.2f"%fit_info
print("%s 年龄是 %d 身高是%.2f"%fit_info)
print(infostr)

#元组与列表之间的转换
name_tuple=tuple(name_list)
print("将列表转换为元组",name_tuple)

#字典的定义
xiaoMing={"name":"Mango",
          "age":21,
          3:1.39,
          ("love","hab"):("travel",69)}
print(xiaoMing)
print("key list",xiaoMing.keys())
print("value list",xiaoMing.values())
print("get tuple key->values",xiaoMing.get(('love')))
xiaoMing["newkey"]="new value"
for k in xiaoMing:
    print("%s -> %s"%(k,xiaoMing[k]))

